home *** CD-ROM | disk | FTP | other *** search
/ Eagles Nest BBS 8 / Eagles_Nest_Mac_Collection_Disc_8.TOAST / Developer Tools⁄Additions / MacTCPToolBx / TCP XCMD Example / background_2599.txt < prev    next >
Text File  |  1989-06-01  |  9KB  |  389 lines

  1. -- background: 2599 from stack: in
  2. -- bmap block id: 3901
  3. -- flags: 0000
  4. -- background id: 0
  5. -- name: 
  6. ----- HyperTalk script -----
  7. on idle
  8.   global connectionID
  9.   --put the heapSpace
  10.   if connectionID is empty then
  11.     put "no connection" into field "state"
  12.     exit idle
  13.   end if
  14.   get TCPState(connectionID)
  15.   put it into field "state"
  16.   if it is not "established" then exit idle
  17.   put TCPRecvUpTo(connectionID,return,10,empty) into newInput
  18.   if newInput is not empty then
  19.     get rect of field "screen"
  20.     get (item 4 of it) - (item 2 of it)
  21.     put (it div (the textHeight of field "screen"))-1 into linesAvail
  22.     get field "screen" & newInput
  23.     put the number of lines in it into linesThere
  24.     if linesThere > linesAvail then
  25.       delete line 1 to (linesThere-linesAvail) of it
  26.     end if
  27.     put it into field "screen"
  28.   end if
  29. end idle
  30.  
  31. on openCard
  32.   global connectionID
  33.   put empty into connectionID
  34. end openCard
  35.  
  36. on closeCard
  37.   global connectionID
  38.   if connectionID is not empty then
  39.     TCPRelease connectionID
  40.     put empty into connectionID
  41.   end if
  42. end closeCard
  43.  
  44.  
  45.  
  46. -- part 43 (field)
  47. -- low flags: 02
  48. -- high flags: 4000
  49. -- rect: left=127 top=209 right=223 bottom=331
  50. -- title width / last selected line: 0
  51. -- icon id / first selected line: 0 / 0
  52. -- text alignment: 0
  53. -- font id: 3
  54. -- text size: 9
  55. -- style flags: 0
  56. -- line height: 12
  57. -- part name: hostName
  58. ----- HyperTalk script -----
  59. on closeField
  60.   put TCPNameToAddr(field "hostName") into field "address"
  61. end closeField
  62.  
  63.  
  64.  
  65. -- part 26 (field)
  66. -- low flags: 02
  67. -- high flags: 4000
  68. -- rect: left=22 top=232 right=248 bottom=265
  69. -- title width / last selected line: 0
  70. -- icon id / first selected line: 0 / 0
  71. -- text alignment: 65535
  72. -- font id: 3
  73. -- text size: 9
  74. -- style flags: 0
  75. -- line height: 12
  76. -- part name: address
  77.  
  78.  
  79. -- part 2 (field)
  80. -- low flags: 01
  81. -- high flags: 0001
  82. -- rect: left=18 top=26 right=163 bottom=493
  83. -- title width / last selected line: 0
  84. -- icon id / first selected line: 0 / 0
  85. -- text alignment: 0
  86. -- font id: 3
  87. -- text size: 9
  88. -- style flags: 0
  89. -- line height: 12
  90. -- part name: screen
  91.  
  92.  
  93. -- part 7 (button)
  94. -- low flags: 00
  95. -- high flags: 0004
  96. -- rect: left=411 top=297 right=326 bottom=443
  97. -- title width / last selected line: 0
  98. -- icon id / first selected line: 21700 / 21700
  99. -- text alignment: 1
  100. -- font id: 0
  101. -- text size: 12
  102. -- style flags: 0
  103. -- line height: 16
  104. -- part name: Home
  105. ----- HyperTalk script -----
  106. on mouseUp
  107.   visual effect iris open
  108.   go Home
  109. end mouseUp
  110.  
  111.  
  112.  
  113. -- part 18 (button)
  114. -- low flags: 00
  115. -- high flags: 0004
  116. -- rect: left=367 top=297 right=326 bottom=399
  117. -- title width / last selected line: 0
  118. -- icon id / first selected line: 2478 / 2478
  119. -- text alignment: 1
  120. -- font id: 0
  121. -- text size: 12
  122. -- style flags: 0
  123. -- line height: 16
  124. -- part name: Home
  125. ----- HyperTalk script -----
  126. on mouseUp
  127.   visual effect iris open
  128.   go to next card
  129. end mouseUp
  130.  
  131.  
  132.  
  133. -- part 27 (field)
  134. -- low flags: 02
  135. -- high flags: 4000
  136. -- rect: left=208 top=248 right=264 bottom=265
  137. -- title width / last selected line: 0
  138. -- icon id / first selected line: 0 / 0
  139. -- text alignment: 65535
  140. -- font id: 3
  141. -- text size: 9
  142. -- style flags: 0
  143. -- line height: 12
  144. -- part name: port
  145.  
  146.  
  147. -- part 28 (field)
  148. -- low flags: 02
  149. -- high flags: 4000
  150. -- rect: left=208 top=264 right=280 bottom=265
  151. -- title width / last selected line: 0
  152. -- icon id / first selected line: 0 / 0
  153. -- text alignment: 65535
  154. -- font id: 3
  155. -- text size: 9
  156. -- style flags: 0
  157. -- line height: 12
  158. -- part name: local port
  159.  
  160.  
  161. -- part 29 (button)
  162. -- low flags: 00
  163. -- high flags: A002
  164. -- rect: left=26 top=259 right=274 bottom=95
  165. -- title width / last selected line: 0
  166. -- icon id / first selected line: 0 / 0
  167. -- text alignment: 1
  168. -- font id: 3
  169. -- text size: 10
  170. -- style flags: 0
  171. -- line height: 13
  172. -- part name: ActiveOpen
  173. ----- HyperTalk script -----
  174. on mouseUp
  175.   global connectionID
  176.   put TCPActiveOpen(item 1 of field "address", field "port", field "local port") into connectionID
  177.   if connectionID contains "fail" then
  178.     put "The Result:" && connectionID
  179.     put empty into connectionID
  180.   end if
  181. end mouseUp
  182.  
  183.  
  184.  
  185. -- part 31 (button)
  186. -- low flags: 00
  187. -- high flags: A002
  188. -- rect: left=100 top=259 right=274 bottom=169
  189. -- title width / last selected line: 0
  190. -- icon id / first selected line: 0 / 0
  191. -- text alignment: 1
  192. -- font id: 3
  193. -- text size: 10
  194. -- style flags: 0
  195. -- line height: 13
  196. -- part name: PassiveOpen
  197. ----- HyperTalk script -----
  198. on mouseUp
  199.   global connectionID
  200.   put TCPPassiveOpen(item 1 of field "address",field "port", field "local port") into connectionID
  201.   if connectionID contains "fail" then
  202.     put "The Result:" && connectionID
  203.     put empty into connectionID
  204.   end if
  205. end mouseUp
  206.  
  207.  
  208.  
  209. -- part 32 (button)
  210. -- low flags: 00
  211. -- high flags: C006
  212. -- rect: left=274 top=282 right=298 bottom=331
  213. -- title width / last selected line: 0
  214. -- icon id / first selected line: 0 / 0
  215. -- text alignment: 1
  216. -- font id: 3
  217. -- text size: 10
  218. -- style flags: 0
  219. -- line height: 13
  220. -- part name: CrLf
  221. ----- HyperTalk script -----
  222. on mouseUp
  223.   set the hilite of bg button "CrLf" to true
  224.   set the hilite of bg button "Cr" to false
  225.   set the hilite of bg button "Nothing" to false
  226. end mouseUp
  227.  
  228.  
  229.  
  230. -- part 33 (button)
  231. -- low flags: 00
  232. -- high flags: 8006
  233. -- rect: left=274 top=296 right=312 bottom=331
  234. -- title width / last selected line: 0
  235. -- icon id / first selected line: 0 / 0
  236. -- text alignment: 1
  237. -- font id: 3
  238. -- text size: 10
  239. -- style flags: 0
  240. -- line height: 13
  241. -- part name: Cr
  242. ----- HyperTalk script -----
  243. on mouseUp
  244.   set the hilite of bg button "Cr" to true
  245.   set the hilite of bg button "CrLf" to false
  246.   set the hilite of bg button "Nothing" to false
  247. end mouseUp
  248.  
  249.  
  250.  
  251. -- part 34 (button)
  252. -- low flags: 00
  253. -- high flags: 8006
  254. -- rect: left=274 top=310 right=326 bottom=331
  255. -- title width / last selected line: 0
  256. -- icon id / first selected line: 0 / 0
  257. -- text alignment: 1
  258. -- font id: 3
  259. -- text size: 10
  260. -- style flags: 0
  261. -- line height: 13
  262. -- part name: Nothing
  263. ----- HyperTalk script -----
  264. on mouseUp
  265.   set the hilite of bg button "Nothing" to true
  266.   set the hilite of bg button "Cr" to false
  267.   set the hilite of bg button "CrLf" to false
  268. end mouseUp
  269.  
  270.  
  271.  
  272. -- part 36 (button)
  273. -- low flags: 00
  274. -- high flags: A002
  275. -- rect: left=127 top=284 right=303 bottom=205
  276. -- title width / last selected line: 0
  277. -- icon id / first selected line: 0 / 0
  278. -- text alignment: 1
  279. -- font id: 0
  280. -- text size: 12
  281. -- style flags: 0
  282. -- line height: 16
  283. -- part name: Send Line
  284. ----- HyperTalk script -----
  285. on mouseUp
  286.   global connectionID
  287.   ask "Line to send:"
  288.   if it is not empty then
  289.     if the hilite of bg button "Cr" then
  290.       put return after it
  291.     else if the hilite of bg button "CrLf" then
  292.       put return & linefeed after it
  293.     end if
  294.     TCPSend connectionID,it
  295.     if the result is not empty then put "The Result:" && the result
  296.     if the optionKey is down then
  297.       put TCPRecvMsg(connectionID,1800,"2",10000) into newInput
  298.       if newInput is not empty then
  299.         get rect of field "screen"
  300.         get (item 4 of it) - (item 2 of it)
  301.         put (it div (the textHeight of field "screen"))-1 into linesAvail
  302.         get field "screen" & newInput
  303.         put the number of lines in it into linesThere
  304.         if linesThere > linesAvail then
  305.           delete line 1 to (linesThere-linesAvail) of it
  306.         end if
  307.         put it into field "screen"
  308.       end if
  309.     end if
  310.   end if
  311. end mouseUp
  312.  
  313.  
  314.  
  315. -- part 37 (field)
  316. -- low flags: 01
  317. -- high flags: 0000
  318. -- rect: left=66 top=308 right=326 bottom=205
  319. -- title width / last selected line: 0
  320. -- icon id / first selected line: 0 / 0
  321. -- text alignment: 0
  322. -- font id: 2
  323. -- text size: 12
  324. -- style flags: 0
  325. -- line height: 16
  326. -- part name: state
  327.  
  328.  
  329. -- part 40 (button)
  330. -- low flags: 00
  331. -- high flags: A002
  332. -- rect: left=19 top=169 right=184 bottom=93
  333. -- title width / last selected line: 0
  334. -- icon id / first selected line: 0 / 0
  335. -- text alignment: 1
  336. -- font id: 3
  337. -- text size: 10
  338. -- style flags: 0
  339. -- line height: 13
  340. -- part name: Clear Display
  341. ----- HyperTalk script -----
  342. on mouseUp
  343.   put empty into field "screen"
  344. end mouseUp
  345.  
  346.  
  347.  
  348. -- part 41 (button)
  349. -- low flags: 00
  350. -- high flags: A002
  351. -- rect: left=25 top=285 right=300 bottom=71
  352. -- title width / last selected line: 0
  353. -- icon id / first selected line: 0 / 0
  354. -- text alignment: 1
  355. -- font id: 3
  356. -- text size: 10
  357. -- style flags: 0
  358. -- line height: 13
  359. -- part name: Close
  360. ----- HyperTalk script -----
  361. on mouseUp
  362.   global connectionID
  363.   TCPClose connectionID
  364.   if the result is not empty then put "The Result:" && the result
  365. end mouseUp
  366.  
  367.  
  368.  
  369. -- part 42 (button)
  370. -- low flags: 00
  371. -- high flags: A002
  372. -- rect: left=75 top=285 right=300 bottom=121
  373. -- title width / last selected line: 0
  374. -- icon id / first selected line: 0 / 0
  375. -- text alignment: 1
  376. -- font id: 3
  377. -- text size: 10
  378. -- style flags: 0
  379. -- line height: 13
  380. -- part name: Release
  381. ----- HyperTalk script -----
  382. on mouseUp
  383.   global connectionID
  384.   TCPRelease connectionID
  385.   if the result is not empty then put "The Result:" && the result
  386.   put empty into connectionID
  387. end mouseUp
  388.  
  389.